package xyz.ddlnt.serviceusr.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.vo.TechnologyInfoVO;
import xyz.ddlnt.serviceusr.service.TechnologyService;

import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/5 1:31
 */
@Slf4j
@RequestMapping("/technology")
@RestController
@RequiredArgsConstructor
public class TechnologyController {

    private final TechnologyService technologyService;

    /**
     * 根据类别id查询类别下所有科目信息
     * @param categoryId
     * @return
     */
    @GetMapping("/selectByCategoryId")
    public Result<List<TechnologyInfoVO>> selectByCategoryId(@RequestParam Long categoryId) {
        List<TechnologyInfoVO> technologyVOList = technologyService.selectByCategoryId(categoryId);
        return Result.success(technologyVOList);
    }
    /**
     * 根据科目id查询科目信息
     * @param technologyId
     * @return
     */
    @GetMapping("/selectByTechnologyId")
    public Result<TechnologyInfoVO> selectByTechnologyId(@RequestParam Long technologyId) {
        TechnologyInfoVO technologyVO = technologyService.selectByTechnologyId(technologyId);
        return Result.success(technologyVO);
    }

}
